package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class AddOperation implements IOperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("增加图书");
        System.out.print("请输入书名");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        System.out.print("请输入作者名");
        String author = scanner.nextLine();
        System.out.print("请输入价格");
        int price = scanner.nextInt();
        System.out.print("请输入书的类型");
        String type = scanner.next();
        Book book = new Book(name,author,price,type);
        bookList.setBook(book, bookList.getBookNum());
        bookList.setBookNum(bookList.getBookNum()+1);
        System.out.println("增加成功");

    }
}
